package com.github.beihaifeiwu.myspring.autoconfigure;

import com.github.beihaifeiwu.myspring.curator.CuratorClientConfiguration;
import com.github.beihaifeiwu.myspring.curator.CuratorProperties;
import com.github.beihaifeiwu.myspring.curator.zookeeper.ZooKeeperProperties;
import com.github.beihaifeiwu.myspring.curator.zookeeper.embedded.EmbeddedZookeeperConfiguration;
import org.apache.curator.framework.CuratorFramework;
import org.apache.zookeeper.ZooKeeper;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * Created by liupin on 2017/6/7.
 */
@Configuration
public class CuratorAutoConfiguration {

    @Configuration
    @ConditionalOnClass(ZooKeeper.class)
    @Import(EmbeddedZookeeperConfiguration.class)
    @EnableConfigurationProperties(ZooKeeperProperties.class)
    public static class ZookeeperConfiguration {
    }

    @Configuration
    @ConditionalOnClass({ CuratorFramework.class })
    @Import({ CuratorClientConfiguration.class })
    @EnableConfigurationProperties(CuratorProperties.class)
    public static class CuratorConfiguration {

    }
}
